import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DepVO, DepForm, DepQuery } from '@/api/base/dep/types';

/**
 * 查询医院科室列表
 * @param query
 * @returns {*}
 */

export const listDep = (query?: DepQuery): AxiosPromise<DepVO[]> => {
  return request({
    url: '/system/dep/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询医院科室详细
 * @param id
 */
export const getDep = (id: string | number): AxiosPromise<DepVO> => {
  return request({
    url: '/system/dep/' + id,
    method: 'get'
  });
};

/**
 * 新增医院科室
 * @param data
 */
export const addDep = (data: DepForm) => {
  return request({
    url: '/system/dep',
    method: 'post',
    data: data
  });
};

/**
 * 修改医院科室
 * @param data
 */
export const updateDep = (data: DepForm) => {
  return request({
    url: '/system/dep',
    method: 'put',
    data: data
  });
};

/**
 * 删除医院科室
 * @param id
 */
export const delDep = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/dep/' + id,
    method: 'delete'
  });
};
